package org.pzy.spring.factory.support;

import org.pzy.spring.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: DRevelation
 * @Date: 2022/3/17 10:17
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    private Map<String, Object> singletonBeanMap = new HashMap<>();

    @Override
    public Object getSingleton(String name) {
        return singletonBeanMap.get(name);
    }

    protected void addSingleton(String name, Object object) {
        singletonBeanMap.put(name, object);
    }
}
